import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';

class Swiper extends StatefulWidget {
  @override
  _SwiperState createState() => _SwiperState();
}

class _SwiperState extends State<Swiper> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: CarouselSlider(
        items: [
          // 添加轮播图的图片或其他内容
          Container(
            alignment: Alignment.topCenter,
            decoration: const BoxDecoration(
              image: DecorationImage(
                image: AssetImage('assets/images/show0.jpg'),
                fit: BoxFit.cover,
              ),
            ),
          ),
          Container(
            alignment: Alignment.topCenter,
            decoration: const BoxDecoration(
              image: DecorationImage(
                image: AssetImage('assets/images/f2.jpg'),
                fit: BoxFit.cover,
              ),
            ),
          ),
          Container(
            alignment: Alignment.topCenter,
            decoration: const BoxDecoration(
              image: DecorationImage(
                // image: AssetImage('assets/images/box-03.jpg'),
                image: AssetImage('assets/images/show3.jpg'),
                fit: BoxFit.cover,
              ),
            ),
          ),
        ],

        options: CarouselOptions(
          // 设置轮播图的配置选项
          aspectRatio: 33 / 13,
          autoPlay: true,
          enlargeCenterPage: true,
        ),
      ),
    );
  }
}
